
import java.util.Scanner;


public class clsPhanSo{
	private int m_iTuSo;
	private int m_iMauSo;
   
	
	public int getTuSO(){
		return m_iTuSo;
	}
	
	public int getMauSo(){
		return m_iMauSo;
	}
	
	public void setTuSo(int _iTuSo){
		m_iTuSo = _iTuSo;
	}
	
	public void setMauSo(int _iMauSo){
		m_iMauSo = _iMauSo;		
	}
	
	public clsPhanSo(){
		m_iMauSo = 1;
		m_iTuSo = 0; 
	}
	public clsPhanSo(int _iTuSo, int _iMauSo){
		if(_iMauSo == 0){
			m_iMauSo = 1;
                        m_iTuSo = 0;
		}
		else{
                        m_iMauSo = _iTuSo;
                        m_iTuSo = _iMauSo;
		}
	}
	
	public clsPhanSo Tong(clsPhanSo ps){
		ps.m_iMauSo = ps.m_iMauSo*this.m_iMauSo;
		ps.m_iTuSo = ps.m_iTuSo*this.m_iMauSo + this.m_iTuSo*ps.m_iMauSo;
		return ps;
	}
	public clsPhanSo Hieu(clsPhanSo ps) {
		ps.m_iMauSo = ps.m_iMauSo*this.m_iMauSo;
		ps.m_iTuSo = ps.m_iTuSo*this.m_iMauSo - this.m_iTuSo*ps.m_iMauSo;
		return ps;
	}
	public clsPhanSo Tich(clsPhanSo ps){
		ps.m_iMauSo = ps.m_iMauSo*this.m_iMauSo;
		ps.m_iTuSo = ps.m_iTuSo*this.m_iTuSo;
		return ps;
	}
	public clsPhanSo Thuong (clsPhanSo ps){
		ps.m_iMauSo = ps.m_iMauSo*this.m_iTuSo;
		ps.m_iTuSo = ps.m_iTuSo*this.m_iMauSo;
		return ps;
	}
        public void Nhap(){
            clsPhanSo ps = new clsPhanSo();
            Scanner sn = new Scanner(System.in);
            System.out.print("Nhap tu So");
            int iTu = Integer.parseInt(sn.nextLine());
            System.out.print("Nhap Mau So");
            int iMau = Integer.parseInt(sn.nextLine());
            ps.setMauSo(iMau);
            ps.setTuSo(iTu);            
        }
}